#include <iostream>

class Complex
{
private:
    double real, imag;
public:
    Complex() : real(0), imag(0) {}
    Complex(double real, double imag) : real(real), imag(imag) {}

    Complex operator+(const Complex& complex) const;
    Complex operator-(const Complex& complex) const;
    Complex operator*(const Complex& complex) const;
    Complex operator/(const Complex& complex) const;

    friend std::ostream& operator<<(std::ostream& stream, const Complex& complex);
};

Complex Complex::operator+(const Complex& complex) const
{
    return Complex(real + complex.real, imag + complex.imag);
}

Complex Complex::operator-(const Complex& complex) const
{
    return Complex(real - complex.real, imag - complex.imag);
}

Complex Complex::operator*(const Complex& complex) const
{
    double resultReal = real * complex.real - imag * complex.imag;
    double resultImag = real * complex.imag + imag * complex.real;
    return Complex(resultReal, resultImag);
}

Complex Complex::operator/(const Complex& complex) const
{
    double divisor = complex.real * complex.real + complex.imag * complex.imag;
    double resultReal = (real * complex.real + imag * complex.imag) / divisor;
    double resultImag = (imag * complex.real - real * complex.imag) / divisor;
    return Complex(resultReal, resultImag);
}

std::ostream& operator<<(std::ostream& stream, const Complex& complex)
{
    stream << complex.real << " + " << complex.imag << "i";
    return stream;
}

int main()
{
    Complex c1(1, 2), c2(2, 3), c3;
    c3 = c1 + c2;
    std::cout << "Addition: " << c3 << std::endl;

    c3 = c1 - c2;
    std::cout << "Subtraction: " << c3 << std::endl;

    c3 = c1 * c2;
    std::cout << "Multiplication: " << c3 << std::endl;

    c3 = c1 / c2;
    std::cout << "Division: " << c3 << std::endl;

    return 0;
}
